﻿namespace WMS6.Web.Configuration
{
    using System;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;
    using WMS6.Web.UserControls;

    public class TransportEquipmentQuery : BasePage
    {
        protected Button btnExport;
        protected Button btnList;
        protected Button btnNew;
        protected Button btnSearch;
        protected DropDownList ddlCarrierID;
        protected DropDownList ddlEquipmentType;
        protected DropDownList ddlIsActive;
        protected DropDownList ddlIsActiveOper;
        protected DropDownList ddlStatusOper;
        protected DropDownList ddlTransportEquipmentID;
        protected HtmlForm F2230;
        protected HtmlInputHidden hdnActionID;
        protected Label lblBu;
        protected Label lblCarrierID;
        protected Label lblEquipmentType;
        protected Label lblIsActive;
        protected Label lblStatus;
        protected Label lblTransportEquipmentID;
        protected MultipleSelectControl MSCStatus;
        protected HtmlLink mycss;
        protected ScriptManager ScriptManager1;
        protected TextBox txtCarrierID;
        protected TextBox txtEquipmentType;
        protected TextBox txtTransportEquipmentID;

        protected void btnList_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("TransportEquipmentList.aspx?action={0}&from=list", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("TransportEquipmentList.aspx?action={0}", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        private void LoadDll()
        {
            base.InitQueryDDL(this.ddlTransportEquipmentID, 0);
            base.InitQueryDDL(this.ddlCarrierID, 0);
            base.InitQueryDDL(this.ddlEquipmentType, 0);
            base.InitQueryDDL(this.ddlStatusOper, 0);
            base.InitQueryDDL(this.ddlIsActiveOper, 0);
            base.InitIsActiveDDL(this.ddlIsActive, 0);
            base.BindData2DDLBySysCode(this.MSCStatus, "EquipmentStatus");
            this.ddlStatusOper.SelectedValue = "One Of";
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadDll();
                if (!string.IsNullOrEmpty(base.Request.QueryString["action"]))
                {
                    this.btnExport.Visible = false;
                    this.btnNew.Visible = false;
                    this.ddlIsActive.SelectedValue = "Y";
                    this.ddlIsActive.Enabled = false;
                }
            }
        }

        public string CarrierID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtCarrierID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtCarrierID.Text.Trim(), this.ddlCarrierID.SelectedValue);
                }
                return "";
            }
        }

        public string EquipmentType
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtEquipmentType.Text.Trim()))
                {
                    return base.GetParamsString(this.txtEquipmentType.Text.Trim(), this.ddlEquipmentType.SelectedValue);
                }
                return "";
            }
        }

        public string IsActive
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlIsActive.SelectedValue))
                {
                    return base.GetParamsString(this.ddlIsActive.SelectedValue, this.ddlIsActiveOper.SelectedValue);
                }
                return "";
            }
        }

        public string Status
        {
            get
            {
                if (!string.IsNullOrEmpty(this.MSCStatus.ReturnValue))
                {
                    return base.GetParamsString(this.MSCStatus.ReturnValue, this.ddlStatusOper.SelectedValue);
                }
                return "";
            }
        }

        public string TransportEquipmentID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtTransportEquipmentID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtTransportEquipmentID.Text.Trim(), this.ddlTransportEquipmentID.SelectedValue);
                }
                return "";
            }
        }
    }
}

